import request from "@/utils/request";

// 1.新增任务api
export function addTask(data) {
  return request({
    url: "produce/task/saveTask",
    method: "post",
    data: data,
  });
}

// 修改任务
export function editTask(data) {
  return request({
    url: "produce/task/editTask",
    method: "put",
    data: data,
  });
}

// 删除任务
export function removeTask(data) {
  console.log(data);
  return request({
    url: "produce/task/remove/" + data.furnitureId,
    method: "DELETE",
  });
}

// 1.1 获取工序列表api
export function getCraftInfo() {
  return request({
    url: "craftInfo/list",
    method: "get",
  });
}

// 查询工序分页
export function getCraftInfoPaging(query) {
  return request({
    url: "craftInfo/getCraftInfo",
    method: "get",
    params: query,
  });
}

// 查询任务
export function searchTreat(query) {
  return request({
    url: "produce/task/searchTreat/" + query.craftId,
    method: "get",
  });
}

// 新增工序
export function addCraftInfo(data) {
  return request({
    url: "craftInfo/saveInfo",
    method: "post",
    data: data,
  });
}

// 修改工序
export function editCraftInfo(data) {
  let treatValue;
  data.treatValue == "" ? (treatValue = "000") : (treatValue = data.treatValue);
  return request({
    url: "craftInfo/edit/" + treatValue,
    method: "PUT",
    data: data.data,
  });
}

// 删除工序
export function removeCraftInfo(data) {
  console.log(data);
  return request({
    url: "craftInfo/remove/" + data.craftId,
    method: "DELETE",
  });
}

// 获取单组信息
export function getEmPros(data) {
  return request({
    url: "craftTask/getEmPros",
    method: "post",
    data: data,
  });
}

// 1.2 获取员工列列表api
export function searchUsers() {
  return request({
    url: "employee/searchUsers",
    method: "get",
  });
}

// 2.查询任务列表api
export function searchTasks(query) {
  return request({
    url: "produce/task/searchTasks",
    method: "get",
    params: query,
  });
}

//  查询岗位列表
export function searchEpes() {
  return request({
    url: "epePost/searchEpes",
    method: "get",
  });
}

// 新增岗位
export function saveEpe(data) {
  return request({
    url: "epePost/saveEpe",
    method: "post",
    data: data,
  });
}

// 修改岗位
export function editEpe(data) {
  return request({
    url: "epePost/editEpe",
    method: "PUT",
    data: data,
  });
}

// 移除岗位
export function removeAllEpeIds(data) {
  return request({
    url: "epePost/removeAll/" + data.epeIds,
    method: "DELETE",
  });
}

// 分页查询员工
export function queryUsers(query) {
  return request({
    url: "employee/queryUsers",
    method: "get",
    params: query,
  });
}

// 新增员工
export function saveUser(data) {
  return request({
    url: "employee/saveUser",
    method: "post",
    data: data,
  });
}

// 修改员工
export function editUser(data) {
  return request({
    url: "employee/editUser",
    method: "PUT",
    data: data,
  });
}

// 移除员工
export function removeAllEmployee(data) {
  return request({
    url: "employee/removeAll/" + data.employeeId,
    method: "DELETE",
  });
}

// 进度管理查看详情
export function searchAllPros(query) {
  return request({
    url: "craftTask/searchAllPros/" + query.furnitureId,
    method: "get",
  });
}

// 工艺列表
export function queryFlowInfos(data) {
  return request({
    url: "/produce-admin/business/tecPro/list",
    method: "get",
    data: data,
  });
}
// 新增工艺
export function saveFlow(data) {
  return request({
    url: "process/saveFlow",
    method: "post",
    data: data,
  });
}
// 修改工艺
export function editFlow(data) {
  return request({
    url: "process/editFlow",
    method: "PUT",
    data: data,
  });
}

// 产品设置

// 产品列表
export function productListApi() {
  return request({
    url: "product/query",
    method: "GET",
  });
}
// 右侧工序列表
export function queryCraftInfos(data) {
  return request({
    url: "product/queryCraftInfos/" + data.processFlowId,
    method: "GET",
  });
}
// 修改价格
export function savePrice(data) {
  return request({
    url: "product/savePrice",
    method: "post",
    data,
  });
}
// 新增产品
export function saveProduct(data) {
  return request({
    url: "product/save",
    method: "post",
    data,
  });
}
